package org.nf.web.servlet.view;

import org.nf.web.servlet.BaseView;
import org.nf.web.servlet.ServletApi;

import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author wangl
 * @date 2021/5/28
 * 重定向视图
 */
public class RedirectView extends BaseView {

    private String url;

    public RedirectView(String url) {
        this.url = url;
    }

    @Override
    protected void render(ServletApi api) throws IOException {
        HttpServletResponse response = api.response();
        response.sendRedirect(url);
    }
}
